package cn.tedu.oa_system.controller;

import cn.tedu.oa_system.base.json_result.ResultDataDto;
import cn.tedu.oa_system.base.json_result.ResultDto;
import cn.tedu.oa_system.pojo.SysMenu;
import cn.tedu.oa_system.pojo.in.FindLikeKeyIn;
import cn.tedu.oa_system.pojo.in.SysMenuIn;
import cn.tedu.oa_system.pojo.vo.SysMenuVO;
import cn.tedu.oa_system.service.SysMenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author MW
 * @Description 系统菜单控制器
 * @CreateDate 2023/3/8
 */
@Slf4j
@RestController
@RequestMapping("/sysmenu")
public class SysMenuController {

    @Autowired
    private SysMenuService sysMenuService;

    @PostMapping("/addsysmenu")
    private ResultDto<Void> addnew(@RequestBody SysMenuIn sysMenuIn){
        return sysMenuService.addNew(sysMenuIn);
    }

    @PostMapping("/delete")
    private ResultDto<Void> delete(@RequestBody SysMenu sysMenu){
        return sysMenuService.delete(sysMenu);
    }

    @PostMapping("update")
    private ResultDto<Void> update(@RequestBody SysMenuIn sysMenuIn){
        return sysMenuService.update(sysMenuIn);
    }

    @PostMapping("/list")
    private ResultDataDto<SysMenuVO> list(@RequestBody FindLikeKeyIn likeKeyIn){
        return sysMenuService.list(likeKeyIn);
    }

    @PostMapping("handle")
    private ResultDto<Void> handle(@RequestBody SysMenuIn sysMenuIn){
        return sysMenuService.upOrDown(sysMenuIn);
    }

}
